package com.yang.system.adapter.driving.persistence.orgMng;

import com.yang.system.common.framework.ChangingStatus;
import com.yang.system.domain.orgMng.emp.Emp;
import com.yang.system.domain.orgMng.emp.EmpStatus;
import com.yang.system.domain.orgMng.emp.SkillLevel;

import java.time.LocalDate;
import java.time.LocalDateTime;

public class RebuiltEmp extends Emp {
    RebuiltEmp(Long tenantId, Long id, LocalDateTime create_at, long created_by) {
        super(tenantId, id, create_at, created_by);
        //由于是从数据库重建，所以状态默认为"不变"
        this.changingStatus = ChangingStatus.UNCHANGED;
    }

    //包级权限，并且用 resetXxx 命名
    RebuiltEmp resetOrgId(Long orgId) {
        this.orgId = orgId;
        return this;
    }

    RebuiltEmp resetNum(String num) {
        this.num = num;
        return this;
    }

    RebuiltEmp resetIdNum(String idNum) {
        this.idNum = idNum;
        return this;
    }

    RebuiltEmp resetName(String name) {
        this.name = name;
        return this;
    }

    RebuiltEmp resetGender(Gender gender) {
        this.gender = gender;
        return this;
    }

    RebuiltEmp resetDob(LocalDate dob) {
        this.dob = dob;
        return this;
    }

    RebuiltEmp resetStatus(EmpStatus status) {
        this.status = status;
        return this;
    }

    // 用 reAddXxx 命名
    public RebuiltEmp reAddSkill(Long id, Long skillTypeId, SkillLevel level, int duration, Long createdBy) {

        RebuiltSkill newSkill = new RebuiltSkill(tenantId, id, skillTypeId, createdBy)
                .resetLevel(level)
                .resetDuration(duration);

        skills.add(newSkill);
        return this;
    }

    public RebuiltEmp reAddExperience(LocalDate startDate, LocalDate endDate, String company, Long userId) {
        // ...
    }

    public RebuiltEmp reAddEmpPost(String postCode, Long userId) {
        // ...
    }

}